# coding: utf-8
# vim: fdm=marker fmr={{{,}}} cms=#%s#

import sys
import os

import time
from datetime import tzinfo, datetime

now=datetime.today()
print(now)
print(now.strftime("%Y-%m-%d %H:%M:%S.%f"))

# seconds
t=time.time()
print(t)

# seconds --> struct_time (丢失毫秒)
lt=time.localtime(t)
print(time.strftime("%Y-%m-%d %H:%M:%S", lt))

# struct_time --> seconds
t2=time.mktime(lt)
print(t2)

# seconds --> datetime (不丢失毫秒)
dt=datetime.fromtimestamp(t)
print(dt.strftime("%Y-%m-%d %H:%M:%S.%f"))
